package com.example.sellersale.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.sellersale.entity.CartInfo;
import com.example.sellersale.entity.Goods;
import com.example.sellersale.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Repository
public interface CartInfoMapper extends BaseMapper<CartInfo> {

    @Select("select * from sys_cartinfo where userId=#{uId}")
    @Results({
            @Result(column = "id",property = "id"),
            @Result(column = "goodsId",property = "goodsId"),
            @Result(column = "price",property = "price"),
            @Result(column = "count",property = "count"),
            @Result(column = "goodsId",property = "goods",javaType= Goods.class,
            one =@One(select = "com.example.sellersale.mapper.GoodsMapper.selectById"))
    })
    List<CartInfo> userCart(String uId);
}
